<?php

namespace App\Repositories;

abstract class BaseRepository
{
    public function __construct()
    {

    }

    /**
     * 获取切换状态
     *
     * @param int $current_state
     *
     * @return int
     */
    protected function _getSwitchState(int $current_state)
    {
        return $current_state ? 0 : 1;
    }

    /**
     * 获取当前时间 微秒
     *
     * @return false|string
     */
    protected function _getMicrosecond()
    {
        list($t1, $t2) = explode(' ', microtime());

        return substr((float)sprintf('%.0f', (floatval($t1) + floatval($t2)) * 1000), -3);
    }
}
